package com.yiman.framework.shiro.service;

import com.yiman.project.system.model.User;
import com.yiman.project.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: Mr.yang
 * @create: 2019-08-07
 **/
@Component
public class LoginService {

    @Autowired
    UserService userService;
    @Autowired
    PasswordService passwordService;

    /**
     * 登录
     */
    public User login(String username, String password){

        // 查询用户信息
        User user = userService.selectUserByLoginName(username);
        passwordService.validate(user, password);
        return user;
    }

}
